//
//  HomePicDetailsViewController.m
//  ioschishan
//
//  Created by 马田成 on 2017/7/11.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "HomePicDetailsViewController.h"
#import "HomePicDetailsOneTableViewCell.h"
#import "HomePicDetailTwoTableViewCell.h"
#import "HomePicDetailThreeOCell.h"
#import "HomePicDetailFourCell.h"
#import "HomePicDetailPingView.h"
#import "HomePicDetailFootTableViewCell.h"
#import "HomePicDeatilThreeOHCell.h"//1
#import "HomePicDetailThreeTHCell.h"//2
#import "HomePicThreeThreeHangCell.h"//3
#import "HomePicZFOneHangTableViewCell.h"//转发cell
#import "HomeDetailNoPicTableViewCell.h"//没有图片
#import "RemarksCellHeightModel.h"
#import "HomePicForwardViewController.h"//转发
#import "MJRefresh.h"

#import "HomePicDetailsDSVC.h"

#import <IQKeyboardManager/IQKeyboardManager.h>
@interface HomePicDetailsViewController ()<UITableViewDelegate, UITableViewDataSource,CAAnimationDelegate,HomePicDetailTwoDelegate, UITextFieldDelegate>
{
    BOOL _isShow; // 是否展开
    NSString *_cellContentStr; // 备注消息
    UIView *grayView;
    NSInteger signID;//判断回复状态
    NSString *byreview_member;//想回复的人ID
    NSString *byreviewName;//想回复的人的名字
    NSString *waterID;//水滴ID
    
}


@property (nonatomic, strong) UITextView *commentTextView;
@property (nonatomic, strong) UILabel *placeHolderLabel;
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) UIView *viewOfFoot;

@property (nonatomic, strong) NSMutableDictionary *dataDic;
@property (nonatomic, strong) NSMutableArray *arrMu;//图片数组
@property (nonatomic, strong) NSMutableArray *upPic;//
@property (nonatomic, strong) NSMutableArray *CommentArr;//评论数组
@property (nonatomic, strong) NSMutableArray *arrOfHead;//打赏头像数组
@property (nonatomic, strong) HomePicDetailPingView *sectionWork;
@property (nonatomic, assign) NSInteger page;

@property (nonatomic, strong) NSMutableDictionary *dicOfData;//打赏数据

@property (nonatomic, strong) UIButton *oneBtn;//1水滴
@property (nonatomic, strong) UIButton *btn9;//9水滴
@property (nonatomic, strong) UIButton *btn19;//19水滴
@property (nonatomic, strong) UIButton *btn99;//99水滴
@property (nonatomic, strong) UILabel *labelOfWater;//打赏水滴
@property (nonatomic, strong) UITextField *numTF;//自己输入打赏数

@end

@implementation HomePicDetailsViewController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self creationData];
    [self waterData];
    [self readNum];
    
    
    __weak typeof(self) weakself = self;
    self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
        
        [weakself creationDataJZ];
    }];
    
    self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        [weakself creationData];
        
        [self.tableView.mj_header beginRefreshing];
    }];
    
}
- (void)viewWillDisappear:(BOOL)animated{
    
    [IQKeyboardManager sharedManager].enable = YES;

}
- (void)viewDidLoad {
    [super viewDidLoad];
    [IQKeyboardManager sharedManager].enableAutoToolbar = YES;//这个是它自带键盘工具条开关
    signID = 1;
    _CommentArr = [NSMutableArray array];
    [self setTitle:@"动态详情"];
    [self creationViewOne];
    [self creationView];
    [self regeditCell];
    
    // Do any additional setup after loading the view.
}
- (void)creationViewOne{
    
    UIView *threadView = [[UIView alloc]initWithFrame:CGRectMake(0, screenScale(1), scrWidth(), screenScale(0.7))];
    threadView.backgroundColor = getColor(@"cccccc");
    [self.view addSubview:threadView];
    self.viewOfFoot = [[UIView alloc] init];
    [self.view addSubview:self.viewOfFoot];
    self.viewOfFoot.backgroundColor = [UIColor whiteColor];
    [self.viewOfFoot mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view);
        make.right.equalTo(self.view);
        make.height.offset(44);
        make.bottom.equalTo(self.view);
        
    }];
    UIView *viewOne = [[UIView alloc] init];
    [self.viewOfFoot addSubview:viewOne];
    [viewOne mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewOfFoot).with.offset(1);
        make.left.equalTo(self.viewOfFoot);
        make.right.equalTo(self.viewOfFoot);
        make.height.offset(1);
        
        
    }];
    viewOne.backgroundColor = getColor(@"CCCCCC");
    
    self.commentTextView = [[UITextView alloc] init];
    [self.viewOfFoot addSubview:self.commentTextView];
//    self.commentTextView.layer.borderWidth = 1.0f;
//    self.commentTextView.layer.borderColor =getColor(@"e3e3e3").CGColor;
    self.commentTextView.layer.cornerRadius = 2;
    self.commentTextView.layer.masksToBounds = YES;
    
    self.commentTextView.font = [UIFont systemFontOfSize:13];
    [self.commentTextView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewOfFoot).with.offset(5);
        make.left.equalTo(self.viewOfFoot).with.offset(15);
        make.right.equalTo(self.viewOfFoot).with.offset(-80);
        make.bottom.equalTo(self.viewOfFoot).with.offset(0);
        
    }];
    
    
    self.placeHolderLabel = [[UILabel alloc] init];
    
    self.placeHolderLabel.numberOfLines = 0;
    self.placeHolderLabel.font = [UIFont systemFontOfSize:13];
    self.placeHolderLabel.text = @"发表评论";
    self.placeHolderLabel.textColor = getColor(@"b6b6b6");
    [self.placeHolderLabel sizeToFit];
    [self.commentTextView addSubview:self.placeHolderLabel];
    
    
    [self.commentTextView setValue:self.placeHolderLabel forKey:@"_placeholderLabel"];

    UIButton *buttonOfSend = [[UIButton alloc] init];
    [self.viewOfFoot addSubview:buttonOfSend];
    [buttonOfSend setTitle:@"发送" forState:UIControlStateNormal];
    buttonOfSend.titleLabel.font = [UIFont systemFontOfSize:11];
    buttonOfSend.backgroundColor = getColor(@"3A95FF");
    [buttonOfSend setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [buttonOfSend mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.viewOfFoot.mas_centerY);
        make.right.equalTo(self.viewOfFoot).with.offset(-5);
        make.top.equalTo(self.viewOfFoot).with.offset(5);
        make.width.offset(70);
        
    }];
    [buttonOfSend addTarget:self action:@selector(commentClick) forControlEvents:UIControlEventTouchUpInside];
    

    
}

- (void)creationView{
    
    self.tableView = [[UITableView alloc] init];
    self.tableView.frame = CGRectMake(0, 2, DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT - 64 - 50);
    
    
    self.tableView.tableFooterView = [[UITableView alloc] initWithFrame:CGRectZero];

//    self.tableView.backgroundColor = [UIColor colorWithRed:245 / 255.0f green:245 / 255.0f blue:245 / 255.0f alpha:1];
    
    self.tableView.backgroundColor = [UIColor whiteColor];
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.estimatedRowHeight = 200;
    [self.view addSubview:self.tableView];
    
    
    //右边item
    UIButton *searchBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, screenScale(40), screenScale(40))];
    [searchBtn setImage:[UIImage imageNamed:@"more_icon"] forState:UIControlStateNormal];
    [searchBtn addTarget:self action:@selector(pianoBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *rightItme = [[UIBarButtonItem alloc]initWithCustomView:searchBtn];
    self.navigationItem.rightBarButtonItem = rightItme;
    

    
}

- (void)regeditCell{
    
    [self.tableView registerNib:[UINib nibWithNibName:@"HomePicDetailsOneTableViewCell" bundle:nil] forCellReuseIdentifier:@"HomePicDetailsOneTableViewCell"];
    [self.tableView registerNib:[UINib nibWithNibName:@"HomePicDetailThreeOCell" bundle:nil] forCellReuseIdentifier:@"HomePicDetailThreeOCell"];
    [self.tableView registerNib:[UINib nibWithNibName:@"HomePicDetailFootTableViewCell" bundle:nil] forCellReuseIdentifier:@"HomePicDetailFootTableViewCell"];
    //1
    [self.tableView registerNib:[UINib nibWithNibName:@"HomePicDeatilThreeOHCell" bundle:nil] forCellReuseIdentifier:@"HomePicDeatilThreeOHCell"];
    //2
    [self.tableView registerNib:[UINib nibWithNibName:@"HomePicDetailThreeTHCell" bundle:nil] forCellReuseIdentifier:@"HomePicDetailThreeTHCell"];
    
    //3
    
    [self.tableView registerNib:[UINib nibWithNibName:@"HomePicThreeThreeHangCell" bundle:nil] forCellReuseIdentifier:@"HomePicThreeThreeHangCell"];
    //转发
    [self.tableView registerNib:[UINib nibWithNibName:@"HomePicZFOneHangTableViewCell" bundle:nil] forCellReuseIdentifier:@"HomePicZFOneHangTableViewCell"];
    //没有图片HomeDetailNoPicTableViewCell
    [self.tableView registerNib:[UINib nibWithNibName:@"HomeDetailNoPicTableViewCell" bundle:nil] forCellReuseIdentifier:@"HomeDetailNoPicTableViewCell"];
    
    
    [self.tableView registerNib:[UINib nibWithNibName:@"HomePicDetailPingView" bundle:nil] forHeaderFooterViewReuseIdentifier:@"HomePicDetailPingView"];
    
}

- (NSMutableArray *)photoDeleSource{
    if (!_arrMu) {
        _arrMu = [NSMutableArray array];
    }
    return  _arrMu;
}
//- (NSMutableArray *)CommentArr{
//    if (!_CommentArr) {
//        _CommentArr = [NSMutableArray array];
//    }
//    return  _CommentArr;
//}
- (NSMutableDictionary *)dataDiction{

    if (!_dataDic) {
        _dataDic = [[NSMutableDictionary alloc] init];
        
    }
    return _dataDic;
    
}
-(NSMutableDictionary *)dicOfData{

    if (!_dicOfData) {
        _dicOfData = [[NSMutableDictionary alloc] init];
        
    }
    return _dicOfData;
    
}
//- (NSMutableArray *)arr{
//    if (!_arrOfHead) {
//        _arrOfHead = [NSMutableArray array];
//    }
//    return  _arrOfHead;
//}

- (void)waterData{
    
    NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
    NSString *token = [PublicFunction getConfigWithKey:@"token"];
    [productParams setValue:token forKey:@"token"];
    [productParams setValue:_tieID forKey:@"id"];
    
    [[MNetworkHandler sharedInstance]conURL:home_IndexgiveWater networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
        
        if ([[returnData objectForKey:@"code"]intValue]==1) {
            
            
            [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:5.0f];
            
        }
        
        else {
            
            [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:5.0f];
            
            
        }
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"%@",error);
        
        [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
        
    }];

    
}


- (void)creationData{
    
    //  _dataArr = [NSMutableArray array];
    _arrOfHead = [NSMutableArray array];
    [self.tableView.mj_header endRefreshing];
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication]keyWindow] animated:YES];
    hud.tag = 500;
    //提示文本
    hud.labelText = @"正在加载...";
    //是否有遮罩
    hud.dimBackground = YES;
    
    _page = 1;
    
    NSString *strPage = [NSString stringWithFormat:@"%ld", (long)_page];
    NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
    
    NSString *token = [PublicFunction getConfigWithKey:@"token"];
    //    NSString *str = @"917b0ddccade4345b1b066fdc4971a14";
    
    [productParams setValue:token forKey:@"token"];
    [productParams setValue:strPage forKey:@"page"];
    [productParams setValue:_tieID forKey:@"id"];
    
    [[MNetworkHandler sharedInstance]conURL:home_CircleGetDetails networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
        
        if ([[returnData objectForKey:@"code"]intValue]==1) {
            [_CommentArr removeAllObjects];
            
            _dataDic=[returnData objectForKey:@"data"];
            NSLog(@"%@", _dataDic);
            _cellContentStr = [_dataDic objectForKey:@"content"];
            _CommentArr = [_dataDic objectForKey:@"comment"];
            _arrMu = [_dataDic objectForKey:@"circle_pic"];
            _arrOfHead = [self.dataDic objectForKey:@"upheader_img"];
        
            [self.tableView reloadData];
            
            
            [hud removeFromSuperview];
        }
        
        else {
            
            [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:5.0f];
            [hud removeFromSuperview];
            
        }
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"%@",error);
        
        [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
        [hud removeFromSuperview];
    }];
    
}

- (void)creationDataJZ{
    
    _page++;
    NSString *strPage = [NSString stringWithFormat:@"%ld", (long)_page];
    NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
    
    NSString *token = [PublicFunction getConfigWithKey:@"token"];
    //  NSString *str = @"917b0ddccade4345b1b066fdc4971a14";
    [productParams setValue:token forKey:@"token"];
    [productParams setValue:strPage forKey:@"page"];
    [productParams setValue:_tieID forKey:@"id"];
    [[MNetworkHandler sharedInstance]conURL:home_CircleGetDetails networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
        
        if ([[returnData objectForKey:@"code"]intValue]==1) {

            NSMutableArray *arr =[NSMutableArray array];

            arr = [[returnData objectForKey:@"data"] objectForKey:@"comment"];
            [_CommentArr addObjectsFromArray:arr];
            
            [self.tableView reloadData];
            [self.tableView.mj_footer endRefreshing];
            
        }
        
        else {
            
            [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:5.0f];
            [self.tableView.mj_footer endRefreshing];
            
        }
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"%@",error);
        
        [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
        
    }];
    
}
#pragma mark ----------阅读量----
- (void)readNum{

    NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
    
    NSString *token = [PublicFunction getConfigWithKey:@"token"];
    [productParams setValue:token forKey:@"token"];
    [productParams setValue:self.tieID forKey:@"id"];
    
    [[MNetworkHandler sharedInstance]conURL:home_Circlereadnum networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
        
        if ([[returnData objectForKey:@"code"]intValue]==1) {
            
        }
        
        else {
            
            [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:5.0f];
            
            
        }
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"%@",error);
        
        [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
        
    }];
    

}




#pragma mark - ---------- Section的数量 ----------
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}
#pragma mark - ---------- Section的内容 ----------
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    if (section == 1) {
        self.sectionWork = [self.tableView dequeueReusableHeaderFooterViewWithIdentifier:@"HomePicDetailPingView"];
        
        self.sectionWork.pingLabel.text = [[self.dataDic objectForKey:@"reading"] stringByAppendingString:@"评论"];
        
        
        return self.sectionWork;

        
    }
    return self.sectionWork;
    
    
}
#pragma mark - ---------- 每个Section的高度 ----------
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 1) {
        return 65;
    }else {
        
        return 0;
        
    }
}
//section 不随tableView滑动
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    
    if (scrollView == self.tableView)
        
    {
        
        CGFloat sectionHeaderHeight = 65; //header高度
        
        if (scrollView.contentOffset.y <= sectionHeaderHeight && scrollView.contentOffset.y >= 0) {
            
            scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
            
        } else if (scrollView.contentOffset.y >= sectionHeaderHeight) {
            
            scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
            
        }
        
    }
    
    
    
}


#pragma mark - ---------- Cell的数量 ----------
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0) {
        return 4;
        
    }else {
        
        return _CommentArr.count;
        
    }
    
    
}

#pragma mark - ---------- 每个Cell的高度 ----------
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    NSMutableDictionary *dicOfFor = [[NSMutableDictionary alloc] init];
    dicOfFor = [self.dataDic objectForKey:@"forward_circle"];
    
    NSString *dictOfForward = [dicOfFor objectForKey:@"forward_user_name"];
    
    
    if (indexPath.section == 0) {
        if (indexPath.row == 0) {
            
            return 61;
            
        }else if (indexPath.row == 1){
        
            return [RemarksCellHeightModel cellHeightWith:_cellContentStr andIsShow:_isShow andLableWidth:BOUNDS.size.width-30 andFont:12 andDefaultHeight:52 andFixedHeight:42 andIsShowBtn:8] - 12;
            
        }else if (indexPath.row == 2){
            
            if (_arrMu.count == 1) {
                
                return 253;
                
            }else if (self.arrMu.count > 1 && self.arrMu.count <= 3){
                
                return 220;
                
            }else if (self.arrMu.count > 3 && self.arrMu.count <= 6){
                
                return 350;
            
            }else if (self.arrMu.count > 6 && self.arrMu.count <= 9){
            
                return 480;
                
            }else if ([dictOfForward length] != 0 && self.arrMu.count == 0){
            
                return 250;
                
            }else {
            
                return 70;
            }
            
            
        }else {
        
            return 113;
            
        }
    }else {
    
        return UITableViewAutomaticDimension;

    }
}
#pragma mark - ---------- 每个Cell的内容 ----------
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    NSMutableDictionary *dicOfFor = [[NSMutableDictionary alloc] init];
    dicOfFor = [self.dataDic objectForKey:@"forward_circle"];
    
    NSString *dictOfForward = [dicOfFor objectForKey:@"forward_user_name"];
    
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    if (indexPath.section == 0) {
        if (indexPath.row == 0) {
            
            HomePicDetailsOneTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"HomePicDetailsOneTableViewCell" forIndexPath:indexPath];
            
            cell.selectionStyle=UITableViewCellSelectionStyleNone;
            cell.user_name.text = [self.dataDic objectForKey:@"user_name"];
            cell.add_time.text = [self.dataDic objectForKey:@"add_time"];
            NSString *urlHeaderPic = manage(AP_HOST, [self.dataDic objectForKey:@"header_img"]);
            [cell.header_img sd_setImageWithURL:[NSURL URLWithString:urlHeaderPic] placeholderImage:[UIImage imageNamed:@""]];
            if ([[self.dataDic objectForKey:@"member_type"] isEqualToString:@"1"]) {
                cell.member_type.text = @"普通";
            }else if ([[self.dataDic objectForKey:@"member_type"] isEqualToString:@"2"]){
                cell.member_type.text = @"老师";
                
            }else if ([[self.dataDic objectForKey:@"member_type"] isEqualToString:@"3"]){
                cell.member_type.text = @"大V";
                
            }else {
                
                cell.member_type.text = @"官方";
            }
            if ([[self.dataDic objectForKey:@"isfollow"] intValue] == 1) {
                cell.followImg.image = [UIImage imageNamed:@"follow_select_icon"];
            }else {
            
                cell.followImg.image = [UIImage imageNamed:@"follow_normal_icon"];
                
            }

            [cell.followButton addTarget:self action:@selector(followClick) forControlEvents:UIControlEventTouchUpInside];
            
            
            return cell;
        }else if (indexPath.row == 1){
        
            static NSString *cellName = @"HomePicDetailTwoTableViewCell";
            HomePicDetailTwoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];
            if (!cell) {
                cell = [[HomePicDetailTwoTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellName];
                cell.delegate = self;
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
            }
            [cell setCellContent:_cellContentStr andIsShow:_isShow  andCellIndexPath:indexPath];
            
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            
            
            return cell;
        
        }else if (indexPath.row == 2){
            
            if (_arrMu.count == 1) {
                //一张图片
                HomePicDetailThreeOCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"HomePicDetailThreeOCell" forIndexPath:indexPath];
                
                cell.selectionStyle=UITableViewCellSelectionStyleNone;
                cell.readingLab.text = [[self.dataDic objectForKey:@"reading"] stringByAppendingString:@"阅读"];
                NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                
                [cell.pic sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                cell.pic.contentMode = UIViewContentModeScaleAspectFill;
                cell.pic.clipsToBounds = YES;
                cell.pic.userInteractionEnabled = YES;
                
                return cell;
            }else if (self.arrMu.count > 1 && self.arrMu.count <= 3){
            
                HomePicDeatilThreeOHCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"HomePicDeatilThreeOHCell" forIndexPath:indexPath];
                cell.readingLab.text = [[self.dataDic objectForKey:@"reading"] stringByAppendingString:@"阅读"];
                
                
                
                cell.selectionStyle=UITableViewCellSelectionStyleNone;
                
                if (self.arrMu.count == 2) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    cell.pic3.hidden = YES;
                    
                }else {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.pic3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic3.clipsToBounds = YES;
                    cell.pic3.userInteractionEnabled = YES;
                    
                }

                return cell;
                
            
            }else if (self.arrMu.count > 3 && self.arrMu.count <= 6) {
            
                HomePicDetailThreeTHCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"HomePicDetailThreeTHCell" forIndexPath:indexPath];
                cell.readingLab.text = [[self.dataDic objectForKey:@"reading"] stringByAppendingString:@"阅读"];
                
                cell.selectionStyle=UITableViewCellSelectionStyleNone;
                if (self.arrMu.count == 4) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.pic3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic3.clipsToBounds = YES;
                    cell.pic3.userInteractionEnabled = YES;

                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.pic4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic4.clipsToBounds = YES;
                    cell.pic4.userInteractionEnabled = YES;
                    
                    cell.pic5.hidden = YES;
                    cell.pic6.hidden = YES;
                    
                    
                    
                    
                }else if (self.arrMu.count == 5) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.pic3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic3.clipsToBounds = YES;
                    cell.pic3.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.pic4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic4.clipsToBounds = YES;
                    cell.pic4.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.pic5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic5.clipsToBounds = YES;
                    cell.pic5.userInteractionEnabled = YES;
                    
                    cell.pic6.hidden = YES;
                    
                }else {
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.pic3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic3.clipsToBounds = YES;
                    cell.pic3.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.pic4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic4.clipsToBounds = YES;
                    cell.pic4.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.pic5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic5.clipsToBounds = YES;
                    cell.pic5.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic6 = manage(AP_HOST, [self.arrMu[5] objectForKey:@"pic"]);
                    
                    [cell.pic6 sd_setImageWithURL:[NSURL URLWithString:urlVpPic6] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic6.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic6.clipsToBounds = YES;
                    cell.pic6.userInteractionEnabled = YES;
                    
                }

                return cell;
                
            
            }else if (self.arrMu.count > 6 && self.arrMu.count <= 9) {
            
                HomePicThreeThreeHangCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"HomePicThreeThreeHangCell" forIndexPath:indexPath];
                cell.readingLab.text = [[self.dataDic objectForKey:@"reading"] stringByAppendingString:@"阅读"];
                cell.selectionStyle=UITableViewCellSelectionStyleNone;
                if (self.arrMu.count == 7) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.pic3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic3.clipsToBounds = YES;
                    cell.pic3.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.pic4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic4.clipsToBounds = YES;
                    cell.pic4.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.pic5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic5.clipsToBounds = YES;
                    cell.pic5.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic6 = manage(AP_HOST, [self.arrMu[5] objectForKey:@"pic"]);
                    
                    [cell.pic6 sd_setImageWithURL:[NSURL URLWithString:urlVpPic6] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic6.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic6.clipsToBounds = YES;
                    cell.pic6.userInteractionEnabled = YES;
                    NSString *urlVpPic7 = manage(AP_HOST, [self.arrMu[6] objectForKey:@"pic"]);
                    
                    [cell.pic7 sd_setImageWithURL:[NSURL URLWithString:urlVpPic7] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic7.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic7.clipsToBounds = YES;
                    cell.pic7.userInteractionEnabled = YES;
                    cell.pic8.hidden = YES;
                    cell.pic9.hidden = YES;
                    
                    
                    
                    
                }else if (self.arrMu.count == 8) {
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.pic3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic3.clipsToBounds = YES;
                    cell.pic3.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.pic4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic4.clipsToBounds = YES;
                    cell.pic4.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.pic5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic5.clipsToBounds = YES;
                    cell.pic5.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic6 = manage(AP_HOST, [self.arrMu[5] objectForKey:@"pic"]);
                    
                    [cell.pic6 sd_setImageWithURL:[NSURL URLWithString:urlVpPic6] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic6.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic6.clipsToBounds = YES;
                    cell.pic6.userInteractionEnabled = YES;
                    NSString *urlVpPic7 = manage(AP_HOST, [self.arrMu[6] objectForKey:@"pic"]);
                    
                    [cell.pic7 sd_setImageWithURL:[NSURL URLWithString:urlVpPic7] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic7.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic7.clipsToBounds = YES;
                    cell.pic7.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic8 = manage(AP_HOST, [self.arrMu[7] objectForKey:@"pic"]);
                    
                    [cell.pic8 sd_setImageWithURL:[NSURL URLWithString:urlVpPic8] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic8.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic8.clipsToBounds = YES;
                    cell.pic8.userInteractionEnabled = YES;
                    
                    cell.pic9.hidden = YES;
                    
                    
                    
                }else {
                    NSString *urlVpPic1 = manage(AP_HOST, [self.arrMu[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic2 = manage(AP_HOST, [self.arrMu[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [self.arrMu[2] objectForKey:@"pic"]);
                    
                    [cell.pic3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic3.clipsToBounds = YES;
                    cell.pic3.userInteractionEnabled = YES;
                    
                    
                    NSString *urlVpPic4 = manage(AP_HOST, [self.arrMu[3] objectForKey:@"pic"]);
                    
                    [cell.pic4 sd_setImageWithURL:[NSURL URLWithString:urlVpPic4] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic4.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic4.clipsToBounds = YES;
                    cell.pic4.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic5 = manage(AP_HOST, [self.arrMu[4] objectForKey:@"pic"]);
                    
                    [cell.pic5 sd_setImageWithURL:[NSURL URLWithString:urlVpPic5] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic5.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic5.clipsToBounds = YES;
                    cell.pic5.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic6 = manage(AP_HOST, [self.arrMu[5] objectForKey:@"pic"]);
                    
                    [cell.pic6 sd_setImageWithURL:[NSURL URLWithString:urlVpPic6] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic6.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic6.clipsToBounds = YES;
                    cell.pic6.userInteractionEnabled = YES;
                    NSString *urlVpPic7 = manage(AP_HOST, [self.arrMu[6] objectForKey:@"pic"]);
                    
                    [cell.pic7 sd_setImageWithURL:[NSURL URLWithString:urlVpPic7] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic7.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic7.clipsToBounds = YES;
                    cell.pic7.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic8 = manage(AP_HOST, [self.arrMu[7] objectForKey:@"pic"]);
                    
                    [cell.pic8 sd_setImageWithURL:[NSURL URLWithString:urlVpPic8] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic8.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic8.clipsToBounds = YES;
                    cell.pic8.userInteractionEnabled = YES;
                    NSString *urlVpPic9 = manage(AP_HOST, [self.arrMu[8] objectForKey:@"pic"]);
                    
                    [cell.pic9 sd_setImageWithURL:[NSURL URLWithString:urlVpPic9] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic9.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic9.clipsToBounds = YES;
                    cell.pic9.userInteractionEnabled = YES;
                }
                return cell;
                
            }else if ([dictOfForward length] != 0 && self.arrMu.count == 0){
            
                HomePicZFOneHangTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"HomePicZFOneHangTableViewCell" forIndexPath:indexPath];
                cell.readingLab.text = [[self.dataDic objectForKey:@"reading"] stringByAppendingString:@"阅读"];
                cell.selectionStyle=UITableViewCellSelectionStyleNone;
                NSMutableDictionary *dictCircle = [self.dataDic objectForKey:@"forward_circle"];
                
                cell.nameLab.text = [dictCircle objectForKey:@"forward_user_name"];
                cell.contentLab.text = [dictCircle objectForKey:@"forward_content"];
                
                NSMutableArray *arrOfCirPic = [[NSMutableArray alloc] init];
                
                arrOfCirPic = [dictCircle objectForKey:@"pic"];
                
                if (arrOfCirPic.count == 1) {
                    
                    
                    NSString *urlVpPic1 = manage(AP_HOST, [arrOfCirPic[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    cell.pic2.hidden = YES;
                    cell.pic3.hidden = YES;
                    
                    
                }else if (arrOfCirPic.count == 2){
                
                    NSString *urlVpPic1 = manage(AP_HOST, [arrOfCirPic[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    NSString *urlVpPic2 = manage(AP_HOST, [arrOfCirPic[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    cell.pic3.hidden = YES;
                    
                }else if (arrOfCirPic.count == 3){
                
                    NSString *urlVpPic1 = manage(AP_HOST, [arrOfCirPic[0] objectForKey:@"pic"]);
                    
                    [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic1.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic1.clipsToBounds = YES;
                    cell.pic1.userInteractionEnabled = YES;
                    NSString *urlVpPic2 = manage(AP_HOST, [arrOfCirPic[1] objectForKey:@"pic"]);
                    
                    [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic2.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic2.clipsToBounds = YES;
                    cell.pic2.userInteractionEnabled = YES;
                    
                    NSString *urlVpPic3 = manage(AP_HOST, [arrOfCirPic[2] objectForKey:@"pic"]);
                    
                    [cell.pic3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                    
                    cell.pic3.contentMode = UIViewContentModeScaleAspectFill;
                    cell.pic3.clipsToBounds = YES;
                    cell.pic3.userInteractionEnabled = YES;
 
                }
                
                
                return cell;
                
            }else {
            
                HomeDetailNoPicTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"HomeDetailNoPicTableViewCell" forIndexPath:indexPath];
                cell.readingLab.text = [[self.dataDic objectForKey:@"reading"] stringByAppendingString:@"阅读"];
                
                cell.selectionStyle=UITableViewCellSelectionStyleNone;
                
                return cell;
                
            }
            
            
        
        }else {
        
            HomePicDetailFourCell *cell=(HomePicDetailFourCell *)[tableView dequeueReusableCellWithIdentifier:@"HomePicDetailFourCell"];
            if (cell == nil) {
                cell=[[HomePicDetailFourCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"HomePicDetailFourCell"];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
            }

            [cell.buttonFen addTarget:self action:@selector(ForwardClick) forControlEvents:UIControlEventTouchUpInside];
            
            [cell.buttonDa addTarget:self action:@selector(daClick) forControlEvents:UIControlEventTouchUpInside];
            
            [cell.buttonZan addTarget:self action:@selector(zanClick:) forControlEvents:UIControlEventTouchUpInside];
            
            if ([[self.dataDic objectForKey:@"isup"] intValue] == 2) {
                
                 [cell.buttonZan setBackgroundImage:[UIImage imageNamed:@"thumb-up_icon"] forState:UIControlStateNormal];
            }else {
            
                [cell.buttonZan setBackgroundImage:[UIImage imageNamed:@"thumb-up_solid"] forState:UIControlStateNormal];
                
            }

            cell.labelZan.text = [self.dataDic objectForKey:@"up"];
            cell.labelFen.text = [self.dataDic objectForKey:@"forward"];
            cell.labelPing.text = [self.dataDic objectForKey:@"comment_num"];
            [cell.buttonMone addTarget:self action:@selector(moreDSClick) forControlEvents:UIControlEventTouchUpInside];
            
            if (_arrOfHead.count == 0) {
                
                cell.pic1.hidden = YES;
                cell.pic2.hidden = YES;
                cell.pic3.hidden = YES;
                
                
            }else if (_arrOfHead.count == 1){
            
                cell.pic1.hidden = NO;
                NSString *urlVpPic1 = manage(AP_HOST, [_arrOfHead[0] objectForKey:@"header_img"]);
                
                [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                
                
                cell.pic2.hidden = YES;
                cell.pic3.hidden = YES;
                
                
            }else if (_arrOfHead.count == 2){
                cell.pic1.hidden = NO;
                cell.pic2.hidden = NO;
                NSString *urlVpPic1 = manage(AP_HOST, [_arrOfHead[0] objectForKey:@"header_img"]);
                
                [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                
                
                NSString *urlVpPic2 = manage(AP_HOST, [_arrOfHead[1] objectForKey:@"header_img"]);
                
                [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                
                cell.pic3.hidden = YES;
                
                
            
            }else {
                
                cell.pic1.hidden = NO;
                cell.pic2.hidden = NO;
                cell.pic3.hidden = NO;
                
                NSString *urlVpPic1 = manage(AP_HOST, [_arrOfHead[0] objectForKey:@"header_img"]);
                
                [cell.pic1 sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
                
                
                NSString *urlVpPic2 = manage(AP_HOST, [_arrOfHead[1] objectForKey:@"header_img"]);
                
                [cell.pic2 sd_setImageWithURL:[NSURL URLWithString:urlVpPic2] placeholderImage:[UIImage imageNamed:@""]];
                
                NSString *urlVpPic3 = manage(AP_HOST, [_arrOfHead[2] objectForKey:@"header_img"]);
                
                [cell.pic3 sd_setImageWithURL:[NSURL URLWithString:urlVpPic3] placeholderImage:[UIImage imageNamed:@""]];
                
            }

            return cell;

        }
    }else {
    
        HomePicDetailFootTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"HomePicDetailFootTableViewCell" forIndexPath:indexPath];
        
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
        
        NSMutableDictionary *dicComment = self.CommentArr[indexPath.row];
        
        NSString *urlVpPic1 = manage(AP_HOST, [dicComment objectForKey:@"header_img"]);
        
        [cell.header_img sd_setImageWithURL:[NSURL URLWithString:urlVpPic1] placeholderImage:[UIImage imageNamed:@""]];
        cell.review_user_name.text = [dicComment objectForKey:@"review_user_name"];
        cell.add_time.text = [dicComment objectForKey:@"add_time"];
        
        NSString *str = @"回复 ";
        cell.review_content.text = [[[str stringByAppendingString:[dicComment objectForKey:@"byreview_user_name"]] stringByAppendingString:@" :"] stringByAppendingString:[dicComment objectForKey:@"review_content"]];
        
        //被评论人id
        
        [cell callBackCommentBlock:^{
            [self editWorkExperienceWithNSString:[dicComment objectForKey:@"review_user_name"] byreviewID:[dicComment objectForKey:@"review_memeber"]];
            
            
        }];
        
        return cell;
    }
    
}



#pragma mark -- Dalegate
- (void)remarksCellShowContrntWithDic:(NSDictionary *)dic andCellIndexPath:(NSIndexPath *)indexPath
{
    _isShow = [[NSString stringWithFormat:@"%@",[dic objectForKey:@"isShow"]] boolValue];
    
    [_tableView reloadData];
}
#pragma mark - ---------- 右边分享 ----------
- (void)pianoBtnClick{
    
    grayView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT)];
    grayView.backgroundColor = [UIColor colorWithRed:0 / 255.0f green:0 / 255.0f blue:0 / 255.0f alpha:0.2];
    
    [[UIApplication sharedApplication].keyWindow addSubview:grayView];
    
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissContactView)];
    [grayView addGestureRecognizer:tapGesture];
    
    UIView *viewWhite = [[UIView alloc] init];
    [grayView addSubview:viewWhite];
    viewWhite.backgroundColor = [UIColor whiteColor];
    [viewWhite mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(grayView);
        make.right.equalTo(grayView);
        make.bottom.equalTo(grayView);
        make.height.offset(190);
        
    }];
    //微信
    UIButton *buttonWeiXin = [[UIButton alloc] init];
    [grayView addSubview:buttonWeiXin];
    [buttonWeiXin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(24);
        make.left.equalTo(viewWhite).with.offset(27);
        make.height.offset(32);
        make.width.offset(40);
        
    }];
    
    [buttonWeiXin setBackgroundImage:[UIImage imageNamed:@"wechat"] forState:UIControlStateNormal];
    UILabel *labelWeiXin = [[UILabel alloc] init];
    [grayView addSubview:labelWeiXin];
    labelWeiXin.text = @"微信";
    labelWeiXin.font = [UIFont systemFontOfSize:12];
    [labelWeiXin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(72);
        make.centerX.equalTo(buttonWeiXin.mas_centerX);
        make.height.offset(17);
        
    }];
    labelWeiXin.textColor = getColor(@"9B9B9B");
    
    //朋友圈
    
    UIButton *buttonFriend = [[UIButton alloc] init];
    [grayView addSubview:buttonFriend];
    [buttonFriend mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(21);
        make.left.equalTo(buttonWeiXin.mas_right).with.offset((DEF_SCREEN_WIDTH - 54 - 160)/ 3 );
        make.height.offset(40);
        make.width.offset(40);
        
    }];
    
    [buttonFriend setBackgroundImage:[UIImage imageNamed:@"pengyouquan"] forState:UIControlStateNormal];
    UILabel *labelFriend  = [[UILabel alloc] init];
    [grayView addSubview:labelFriend];
    labelFriend.text = @"朋友圈";
    labelFriend.font = [UIFont systemFontOfSize:12];
    [labelFriend mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(72);
        make.centerX.equalTo(buttonFriend.mas_centerX);
        make.height.offset(17);
        
    }];
    labelFriend.textColor = getColor(@"9B9B9B");
    
    
    //QQ
    
    UIButton *buttonQQ = [[UIButton alloc] init];
    [grayView addSubview:buttonQQ];
    [buttonQQ mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(22);
        make.left.equalTo(buttonFriend.mas_right).with.offset((DEF_SCREEN_WIDTH - 54 - 160)/ 3 );
        make.height.offset(38);
        make.width.offset(36);
        
    }];
    
    [buttonQQ setBackgroundImage:[UIImage imageNamed:@"qq"] forState:UIControlStateNormal];
    UILabel *labelQQ  = [[UILabel alloc] init];
    [grayView addSubview:labelQQ];
    labelQQ.text = @"QQ";
    labelQQ.font = [UIFont systemFontOfSize:12];
    [labelQQ mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(72);
        make.centerX.equalTo(buttonQQ.mas_centerX);
        make.height.offset(17);
        
    }];
    labelQQ.textColor = getColor(@"9B9B9B");
    
    //qq空间
    
    UIButton *buttonQQSpace = [[UIButton alloc] init];
    [grayView addSubview:buttonQQSpace];
    [buttonQQSpace mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(20);
        make.left.equalTo(buttonQQ.mas_right).with.offset((DEF_SCREEN_WIDTH - 54 - 160)/ 3 );
        make.height.offset(38);
        make.width.offset(41);
        
    }];
    
    [buttonQQSpace setBackgroundImage:[UIImage imageNamed:@"qzone"] forState:UIControlStateNormal];
    UILabel *labelQQSpace  = [[UILabel alloc] init];
    [grayView addSubview:labelQQSpace];
    labelQQSpace.text = @"QQ空间";
    labelQQSpace.font = [UIFont systemFontOfSize:12];
    [labelQQSpace mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(72);
        make.centerX.equalTo(buttonQQSpace.mas_centerX);
        make.height.offset(17);
        
    }];
    labelQQSpace.textColor = getColor(@"9B9B9B");
    
    UIView *oneView = [[UIView alloc] init];
    [viewWhite addSubview:oneView];
    oneView.backgroundColor = getColor(@"CCCCCC");
    [oneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(viewWhite).with.offset(15);
        make.right.equalTo(viewWhite).with.offset(-15);
        make.height.offset(1);
        make.top.equalTo(labelQQSpace.mas_bottom).with.offset(20);
        
    }];
    
//    //收藏
//    
//    UIButton *buttonCollect = [[UIButton alloc] init];
//    [grayView addSubview:buttonCollect];
//    [buttonCollect mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(oneView.mas_bottom).with.offset(24);
//        make.centerX.equalTo(buttonWeiXin.mas_centerX);
//        make.height.offset(48);
//        make.width.offset(48);
//        
//    }];
//    
//    [buttonCollect setBackgroundImage:[UIImage imageNamed:@"collect"] forState:UIControlStateNormal];
//    UILabel *labelCollect  = [[UILabel alloc] init];
//    [grayView addSubview:labelCollect];
//    labelCollect.text = @"收藏";
//    labelCollect.font = [UIFont systemFontOfSize:12];
//    [labelCollect mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(oneView.mas_bottom).with.offset(72);
//        make.centerX.equalTo(buttonCollect.mas_centerX);
//        make.height.offset(17);
//        
//    }];
//    labelCollect.textColor = getColor(@"9B9B9B");
    
    
    UIView *twoView = [[UIView alloc] init];
    [viewWhite addSubview:twoView];
    twoView.backgroundColor = getColor(@"CCCCCC");
    [twoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(viewWhite);
        make.right.equalTo(viewWhite);
        make.height.offset(1);
        make.top.equalTo(labelQQSpace.mas_bottom).with.offset(20);
        
    }];
    
    UIButton *buttonCancel = [[UIButton alloc] init];
    [viewWhite addSubview:buttonCancel];
    [buttonCancel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(viewWhite);
        make.right.equalTo(viewWhite);
        make.bottom.equalTo(viewWhite);
        make.top.equalTo(twoView.mas_bottom).with.offset(1);
        
    }];
    [buttonCancel setTitle:@"取消" forState:UIControlStateNormal];
    
    buttonCancel.titleLabel.font = [UIFont systemFontOfSize:16];
    buttonCancel.backgroundColor = [UIColor whiteColor];
    [buttonCancel setTitleColor:getColor(@"4A4A4A") forState:UIControlStateNormal];
    
    [buttonCancel addTarget:self action:@selector(dismissContactView) forControlEvents:UIControlEventTouchUpInside];

}

- (void)dismissContactView {
    
    [self.navigationController setNavigationBarHidden:NO animated:NO];
    [grayView removeFromSuperview];
}
#pragma mark - ---------- 发送 ----------
- (void)commentClick{
    
    if (signID == 1) {
        
        NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
        
        NSString *token = [PublicFunction getConfigWithKey:@"token"];
        
        [productParams setValue:token forKey:@"token"];
        [productParams setValue:_tieID forKey:@"id"];
        [productParams setValue:self.commentTextView.text forKey:@"content"];
        
        
        [[MNetworkHandler sharedInstance]conURL:home_Circlerreply networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
            
            if ([[returnData objectForKey:@"code"]intValue]==1) {
                
                [PublicFunction showAlert:nil message:@"评论成功" duration:5.0f];
                self.commentTextView.text = nil;
                [self.tableView reloadData];
                
            }
            
            else {
                
            }
            
            
        } failureBlock:^(NSError *error) {
            
            NSLog(@"%@",error);
            
            [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
            
            
        }];
    }else {
    
        NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
        
        NSString *token = [PublicFunction getConfigWithKey:@"token"];
        
        [productParams setValue:token forKey:@"token"];
        [productParams setValue:_tieID forKey:@"id"];
        [productParams setValue:self.commentTextView.text forKey:@"content"];
        [productParams setValue:byreview_member forKey:@"byreview_member"];
        
        [[MNetworkHandler sharedInstance]conURL:home_CirclerreplyOther networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
            
            if ([[returnData objectForKey:@"code"]intValue]==1) {
                
                [PublicFunction showAlert:nil message:@"评论成功" duration:5.0f];
                self.commentTextView.text = nil;
                [self.tableView reloadData];
                
            }
            
            else {
                
            }
            
            
        } failureBlock:^(NSError *error) {
            
            NSLog(@"%@",error);
            
            [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
            
            
        }];

        
    
    }
    

    
    
    

}
#pragma mark - ---------- 转发 ----------
- (void)ForwardClick{
    HomePicForwardViewController *vc= [[HomePicForwardViewController alloc] init];
    vc.tieID = self.tieID;
    
    [self.navigationController pushViewController:vc animated:YES];

}
#pragma mark - ---------- 查看更多打赏 ----------
- (void)moreDSClick{

    if (_arrOfHead.count == 0) {
         [PublicFunction showAlert:nil message:@"暂时没人打赏" duration:5.0f];
    }else {
    
        HomePicDetailsDSVC *vc = [[HomePicDetailsDSVC alloc] init];
        vc.circle_id = self.tieID;
        [self.navigationController pushViewController:vc animated:YES];
        
    }
    
    
    
}
#pragma mark - ----------回复比人block ----------
- (void)editWorkExperienceWithNSString:(NSString *)circle_id byreviewID:(NSString *)byreviewID{
    
    
    [self.commentTextView removeFromSuperview];
    
    self.commentTextView = [[UITextView alloc] init];
    [self.viewOfFoot addSubview:self.commentTextView];
    self.commentTextView.layer.cornerRadius = 2;
    self.commentTextView.layer.masksToBounds = YES;
    
    self.commentTextView.font = [UIFont systemFontOfSize:13];
    [self.commentTextView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.viewOfFoot).with.offset(5);
        make.left.equalTo(self.viewOfFoot).with.offset(15);
        make.right.equalTo(self.viewOfFoot).with.offset(-80);
        make.bottom.equalTo(self.viewOfFoot).with.offset(0);
        
    }];

    self.placeHolderLabel = [[UILabel alloc] init];
    
    self.placeHolderLabel.numberOfLines = 0;
    self.placeHolderLabel.font = [UIFont systemFontOfSize:13];
    self.placeHolderLabel.text = @"发表评论";
    self.placeHolderLabel.textColor = getColor(@"b6b6b6");
    [self.placeHolderLabel sizeToFit];
    [self.commentTextView addSubview:self.placeHolderLabel];
    
    
    [self.commentTextView setValue:self.placeHolderLabel forKey:@"_placeholderLabel"];
    NSString *str = @"回复";
    self.placeHolderLabel.text = [str stringByAppendingString:circle_id];
    byreview_member = byreviewID;
    signID++;
    
    NSLog(@"OOOOOOOOOOOOOOOOO%ld", signID);
    
    
}
#pragma mark - ----------打赏 ----------
- (void)daClick{
    
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
    NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
    
    NSString *token = [PublicFunction getConfigWithKey:@"token"];
    
    [productParams setValue:token forKey:@"token"];

    [[MNetworkHandler sharedInstance]conURL:home_CircleTours networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
        
        if ([[returnData objectForKey:@"code"]intValue]==1) {
            
            self.dicOfData = [returnData objectForKey:@"data"];
            NSMutableArray *arr = [NSMutableArray array];
            arr = [self.dicOfData objectForKey:@"water"];
            
            [self.oneBtn setTitle:[[arr[0] objectForKey:@"gold_money"]stringByAppendingString:@"水滴"]forState:UIControlStateNormal];
            self.oneBtn.tag =[[arr[0] objectForKey:@"id"] intValue];
 
            [self.btn9 setTitle:[[arr[1] objectForKey:@"gold_money"]stringByAppendingString:@"水滴"]forState:UIControlStateNormal];
            
            self.btn9.tag =[[arr[1] objectForKey:@"id"] intValue];
            
            [self.btn19 setTitle:[[arr[2] objectForKey:@"gold_money"]stringByAppendingString:@"水滴"]forState:UIControlStateNormal];
            self.btn19.tag =[[arr[2] objectForKey:@"id"] intValue];
            [self.btn99 setTitle:[[arr[3] objectForKey:@"gold_money"]stringByAppendingString:@"水滴"]forState:UIControlStateNormal];
            self.btn99.tag =[[arr[3] objectForKey:@"id"] intValue];
            self.labelOfWater.text =[self.dicOfData objectForKey:@"member_water"];
            

        }
        else {
            
        }
        
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"%@",error);
        
        [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
        
        
    }];
    
    grayView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT)];
    grayView.backgroundColor = [UIColor colorWithRed:0 / 255.0f green:0 / 255.0f blue:0 / 255.0f alpha:0.2];
    
    [self.view addSubview:grayView];
    
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissContactView)];
    [grayView addGestureRecognizer:tapGesture];

    UIView *viewWhite = [[UIView alloc] init];
    [grayView addSubview:viewWhite];
    viewWhite.backgroundColor = [UIColor whiteColor];
    [viewWhite mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(grayView);
        make.right.equalTo(grayView);
        make.bottom.equalTo(grayView);
        make.height.offset(270);
        
    }];
    UILabel *labelOfDS = [[UILabel alloc] init];
    labelOfDS.text = @"打赏";
    labelOfDS.font = [UIFont systemFontOfSize:18];
    
    
    [viewWhite addSubview:labelOfDS];
    [labelOfDS mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(10);
        make.left.equalTo(viewWhite).with.offset(20);
        make.height.offset(25);        
        
    }];
    UIButton *buttonCZ = [[UIButton alloc] init];
    [viewWhite addSubview:buttonCZ];
    [buttonCZ mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewWhite).with.offset(20);
        make.right.equalTo(viewWhite).with.offset(-20);
        make.height.offset(18);
        make.width.offset(30);
        
    }];
    [buttonCZ setTitle:@"充值" forState:UIControlStateNormal];
    [buttonCZ setTitleColor:getColor(@"3A95FF") forState:UIControlStateNormal];
    buttonCZ.titleLabel.font = [UIFont systemFontOfSize:13];
    
    self.labelOfWater = [[UILabel alloc] init];
    [viewWhite addSubview:self.labelOfWater];
    [self.labelOfWater mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(buttonCZ.mas_left).with.offset(-5);
        make.centerY.equalTo(buttonCZ);
        make.height.offset(18);
        
    }];
    self.labelOfWater.font = [UIFont systemFontOfSize:13];
    self.labelOfWater.textColor = getColor(@"4A4A4A");
//    self.labelOfWater.text = @"12";
    
    UIImageView *imageWater = [[UIImageView alloc] init];
    [viewWhite addSubview:imageWater];
    [imageWater mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(buttonCZ);
        make.right.equalTo(viewWhite).with.offset(-80);
        
    }];
    imageWater.image = [UIImage imageNamed:@"coin_icon"];
    
    UIView *viewOne = [[UIView alloc] init];
    [viewWhite addSubview:viewOne];
    [viewOne mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(labelOfDS.mas_bottom).with.offset(10);
        make.left.equalTo(labelOfDS).with.offset(20);
        make.right.equalTo(labelOfDS).with.offset(-20);
        make.height.offset(1);
        
    }];
    viewOne.backgroundColor = getColor(@"CCCCCC");
    
    self.oneBtn = [[UIButton alloc] init];
    [viewWhite addSubview:self.oneBtn];
    [_oneBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewOne.mas_bottom).with.offset(20);
        make.left.equalTo(viewWhite).with.offset(20);
        make.width.offset((DEF_SCREEN_WIDTH - 85) / 4);
        make.height.offset(44);
 
    }];
    self.oneBtn.layer.borderWidth = 1.0f;
    self.oneBtn.layer.borderColor = getColor(@"CCCCCC").CGColor;
    self.oneBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.oneBtn setTitleColor:getColor(@"4A4A4A") forState:UIControlStateNormal];
    
    
    self.btn9 = [[UIButton alloc] init];
    [viewWhite addSubview:self.btn9];
    [_btn9 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewOne.mas_bottom).with.offset(20);
        make.left.equalTo(self.oneBtn.mas_right).with.offset(15);
        make.width.offset((DEF_SCREEN_WIDTH - 85) / 4);
        make.height.offset(44);
        
    }];
    self.btn9.layer.borderWidth = 1.0f;
    self.btn9.layer.borderColor = getColor(@"CCCCCC").CGColor;
    self.btn9.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.btn9 setTitleColor:getColor(@"4A4A4A") forState:UIControlStateNormal];
    
    
    
    
    self.btn19 = [[UIButton alloc] init];
    [viewWhite addSubview:self.btn19];
    [_btn19 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewOne.mas_bottom).with.offset(20);
        make.left.equalTo(self.btn9.mas_right).with.offset(15);
        make.width.offset((DEF_SCREEN_WIDTH - 85) / 4);
        make.height.offset(44);
        
    }];
    self.btn19.layer.borderWidth = 1.0f;
    self.btn19.layer.borderColor = getColor(@"CCCCCC").CGColor;
    self.btn19.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.btn19 setTitleColor:getColor(@"4A4A4A") forState:UIControlStateNormal];
    
    self.btn99 = [[UIButton alloc] init];
    [viewWhite addSubview:self.btn99];
    [_btn99 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewOne.mas_bottom).with.offset(20);
        make.right.equalTo(viewWhite).with.offset(-20);
        make.width.offset((DEF_SCREEN_WIDTH - 85) / 4);
        make.height.offset(44);
        
    }];
    self.btn99.layer.borderWidth = 1.0f;
    self.btn99.layer.borderColor = getColor(@"CCCCCC").CGColor;
    self.btn99.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.btn99 setTitleColor:getColor(@"4A4A4A") forState:UIControlStateNormal];
    
    [self.oneBtn addTarget:self action:@selector(waterDDDDDD:) forControlEvents:UIControlEventTouchUpInside];
    [self.btn9 addTarget:self action:@selector(waterDDDDDD:) forControlEvents:UIControlEventTouchUpInside];
    [self.btn19 addTarget:self action:@selector(waterDDDDDD:) forControlEvents:UIControlEventTouchUpInside];
    [self.btn99 addTarget:self action:@selector(waterDDDDDD:) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    self.numTF = [[UITextField alloc] init];
    [viewWhite addSubview:self.numTF];
    [self.numTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.btn99.mas_bottom).with.offset(15);
        make.left.equalTo(viewWhite).with.offset(20);
        make.right.equalTo(viewWhite).with.offset(-20);
        make.height.offset(40);
        
    }];
    
    self.numTF.placeholder = @"请输入水滴";
    self.numTF.keyboardType = UIKeyboardTypeNumberPad;
    
    UIButton *buttonQD = [[UIButton alloc] init];
    [viewWhite addSubview:buttonQD];
    [buttonQD mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.numTF.mas_bottom).with.offset(15);
        make.left.equalTo(viewWhite).with.offset(20);
        make.right.equalTo(viewWhite).with.offset(-20);
        make.height.offset(40);
        
    }];
    buttonQD.backgroundColor = getColor(@"3A95FF");
    [buttonQD setTitle:@"确认" forState:UIControlStateNormal];
    [buttonQD setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    [buttonQD addTarget:self action:@selector(editWater) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    
}
#pragma mark - ---------- 打赏水滴确认 ----------
- (void)editWater{
    
    
    if ([waterID length] == 0) {
        NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
        
        NSString *token = [PublicFunction getConfigWithKey:@"token"];
        
        [productParams setValue:token forKey:@"token"];
        [productParams setValue:_tieID forKey:@"id"];
        [productParams setValue:self.numTF.text forKey:@"reward_num"];
        
        [[MNetworkHandler sharedInstance]conURL:home_Circlereward networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
            
            if ([[returnData objectForKey:@"code"]intValue]==1) {
                
                [PublicFunction showAlert:nil message:@"打赏成功" duration:5.0f];
                
                [self dismissContactView];
                
                
                [self.tableView reloadData];
                
            }
            
            else {
                
                [PublicFunction showAlert:nil message:@"打赏失败" duration:5.0f];
            }
            
            
        } failureBlock:^(NSError *error) {
            
            NSLog(@"%@",error);
            
            [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
            
            
        }];

    }else {
    
        NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
        
        NSString *token = [PublicFunction getConfigWithKey:@"token"];
        
        [productParams setValue:token forKey:@"token"];
        [productParams setValue:_tieID forKey:@"id"];
        [productParams setValue:waterID forKey:@"reward_id"];
        
        [[MNetworkHandler sharedInstance]conURL:home_Circlereward networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
            
            if ([[returnData objectForKey:@"code"]intValue]==1) {
                
                [PublicFunction showAlert:nil message:@"打赏成功" duration:5.0f];
                
                [self dismissContactView];
                
                
                [self.tableView reloadData];
                
            }
            
            else {
                [PublicFunction showAlert:nil message:@"打赏失败" duration:5.0f];
                
            }
            
            
        } failureBlock:^(NSError *error) {
            
            NSLog(@"%@",error);
            
            [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
            
            
        }];

        
    
    }
    
    
    

    

}
#pragma mark - ---------- 点击水滴获取ID ----------
- (void)waterDDDDDD:(UIButton *)sender{

    if ((self.oneBtn.selected ==YES)) {
        
        self.oneBtn.layer.borderWidth = 1.0f;
        self.oneBtn.layer.borderColor = getColor(@"3A95FF").CGColor;
        waterID = [NSString stringWithFormat:@"%ld",(long)self.oneBtn.tag];
        
        self.btn99.layer.borderWidth = 1.0f;
        self.btn99.layer.borderColor = getColor(@"CCCCCC").CGColor;
        self.btn19.layer.borderWidth = 1.0f;
        self.btn19.layer.borderColor = getColor(@"CCCCCC").CGColor;
        self.btn9.layer.borderWidth = 1.0f;
        self.btn9.layer.borderColor = getColor(@"CCCCCC").CGColor;
        
        self.btn9.selected = NO;
        self.btn19.selected = NO;
        self.btn99.selected = NO;
        
        
    }else if ((self.btn9.selected==YES)) {
        
        self.btn9.layer.borderWidth = 1.0f;
        self.btn9.layer.borderColor = getColor(@"3A95FF").CGColor;
        waterID = [NSString stringWithFormat:@"%ld",(long)self.btn9.tag];
        
        self.btn99.layer.borderWidth = 1.0f;
        self.btn99.layer.borderColor = getColor(@"CCCCCC").CGColor;
        self.btn19.layer.borderWidth = 1.0f;
        self.btn19.layer.borderColor = getColor(@"CCCCCC").CGColor;
        self.oneBtn.layer.borderWidth = 1.0f;
        self.oneBtn.layer.borderColor = getColor(@"CCCCCC").CGColor;
        
        self.oneBtn.selected = NO;
        self.btn19.selected = NO;
        self.btn99.selected = NO;

    }else if ((self.btn19.selected==YES)) {
        
        self.btn19.layer.borderWidth = 1.0f;
        self.btn19.layer.borderColor = getColor(@"3A95FF").CGColor;
        waterID = [NSString stringWithFormat:@"%ld",(long)self.btn19.tag];
        
        self.btn99.layer.borderWidth = 1.0f;
        self.btn99.layer.borderColor = getColor(@"CCCCCC").CGColor;
        self.btn9.layer.borderWidth = 1.0f;
        self.btn9.layer.borderColor = getColor(@"CCCCCC").CGColor;
        self.oneBtn.layer.borderWidth = 1.0f;
        self.oneBtn.layer.borderColor = getColor(@"CCCCCC").CGColor;
        
        self.oneBtn.selected = NO;
        self.btn9.selected = NO;
        self.btn99.selected = NO;
  
    }else if ((self.btn99.selected==YES)) {
        
        self.btn99.layer.borderWidth = 1.0f;
        self.btn99.layer.borderColor = getColor(@"3A95FF").CGColor;
        waterID = [NSString stringWithFormat:@"%ld",(long)self.btn99.tag];
        
        self.btn19.layer.borderWidth = 1.0f;
        self.btn19.layer.borderColor = getColor(@"CCCCCC").CGColor;
        self.btn9.layer.borderWidth = 1.0f;
        self.btn9.layer.borderColor = getColor(@"CCCCCC").CGColor;
        self.oneBtn.layer.borderWidth = 1.0f;
        self.oneBtn.layer.borderColor = getColor(@"CCCCCC").CGColor;
        
        self.oneBtn.selected = NO;
        self.btn9.selected = NO;
        self.btn19.selected = NO;

        
    }
    

}

#pragma mark - ---------- 点赞 ----------
- (void)zanClick:(UIButton *)sender{

    NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];

    NSString *token = [PublicFunction getConfigWithKey:@"token"];
    [productParams setValue:token forKey:@"token"];
    [productParams setValue:self.tieID forKey:@"id"];
    
    [[MNetworkHandler sharedInstance]conURL:home_CircleIndexGiveup networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
        
        if ([[returnData objectForKey:@"code"]intValue]==1) {
            
            [self creationData];
        }
        
        else {
            
            [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:5.0f];
            
            
        }
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"%@",error);
        
        [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
        
    }];

    
    
}
#pragma mark - ---------- 关注 ----------
- (void)followClick{
    
    NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
    
    NSString *token = [PublicFunction getConfigWithKey:@"token"];
    [productParams setValue:token forKey:@"token"];
    [productParams setValue:[self.dataDic objectForKey:@"circle_member_id"] forKey:@"passive_member_id"];
    
    [[MNetworkHandler sharedInstance]conURL:more_follow networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
        
        if ([[returnData objectForKey:@"code"]intValue]==1) {
            
            [self creationData];
        }
        
        else {
            
            [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:5.0f];
            
            
        }
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"%@",error);
        
        [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
        
    }];

    

    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
